# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=vdirsyncer
_pyname=$pkgname
pkgver=0.18.0
pkgrel=1
pkgdesc="CLI Synchronization for CalDAV and CardDAV"
url="http://vdirsyncer.pimutils.org"
arch="noarch"
license="BSD-3-Clause"
depends="
	python3
	py3-atomicwrites
	py3-click
	py3-click-log
	py3-click-threading
	py3-requests
	py3-requests-toolbelt
	"
makedepends="py3-setuptools py3-setuptools_scm py3-sphinx"
checkdepends="
	py3-pytest
	py3-pytest-cov
	py3-pytest-httpserver
	py3-hypothesis
	py3-subtesthack
	py3-trustme
	py3-werkzeug
	"
subpackages="$pkgname-doc"
source="https://files.pythonhosted.org/packages/source/${_pyname%"${_pyname#?}"}/$_pyname/$_pyname-$pkgver.tar.gz
	01-fix-ssl-tests.patch"

build() {
	python3 setup.py build
	PYTHONPATH="build:$PYTHONPATH" sphinx-build -b man docs/ build/
}

check() {
	# test_request_ssl requires network
	make DETERMINISTIC_TESTS=true PYTEST_ADDOPTS="--deselect tests/system/utils/test_main.py::test_request_ssl" test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
	install -Dm644 build/$pkgname.1 "$pkgdir"/usr/share/man/man1/$pkgname.1
}

sha512sums="
7fb3d0f7d982d8390d278de1a620231e6ead1ec64057c5dbac98dcff491fa3e6b9ed8ba953995458e393aab73b0b9ab8ba14010e06f90a04d8ee2c28c7c7fbfd  vdirsyncer-0.18.0.tar.gz
09493b5298212fc724b3dfd2a5cffe89fae0857ee1e0a27eb272bf5960b03bac2c0cc8e18a2b9b58de13b8287c2377b1d2fb22b725f10fb243777faa9fd2d3b2  01-fix-ssl-tests.patch
"
